package com.personal.system.service.impl.act;

import java.util.Arrays;
import java.util.List;

import com.personal.system.entity.approval.AuditRuleDetail;
import com.personal.system.mapper.act.AuditRuleDetailMapper;
import org.springframework.stereotype.Service;
import java.util.Date;
import javax.annotation.Resource;
import com.personal.system.service.act.AuditRuleDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
 * 审批流程节点Service业务层处理
 *
 * @author hhdd
 * @date 2023-02-17 09:57:45
 */
@Service
public class AuditRuleDetailServiceImpl extends ServiceImpl<AuditRuleDetailMapper, AuditRuleDetail> implements AuditRuleDetailService {

    @Resource
    private AuditRuleDetailMapper auditRuleDetailMapper;

    /**
     * 查询审批流程节点
     *
     * @param ruleDetailId 审批流程节点ID
     * @return 审批流程节点
     */
    @Override
    public AuditRuleDetail selectAuditRuleDetailById(String ruleDetailId) {
        return auditRuleDetailMapper.selectById(ruleDetailId);
    }

    /**
     * 查询审批流程节点列表
     *
     * @param auditRuleDetail 审批流程节点
     * @return 审批流程节点
     */
    @Override
    public List<AuditRuleDetail> selectAuditRuleDetailList(AuditRuleDetail auditRuleDetail) {
        return auditRuleDetailMapper.selectList(null);
    }

    /**
     * 新增审批流程节点
     *
     * @param auditRuleDetail 审批流程节点
     * @return 结果
     */
    @Override
    public int insertAuditRuleDetail(AuditRuleDetail auditRuleDetail) {
        auditRuleDetail.setCreateTime(new Date());
        return auditRuleDetailMapper.insert(auditRuleDetail);
    }

    /**
     * 修改审批流程节点
     *
     * @param auditRuleDetail 审批流程节点
     * @return 结果
     */
    @Override
    public int updateAuditRuleDetail(AuditRuleDetail auditRuleDetail) {
        auditRuleDetail.setUpdateTime(new Date());
        return auditRuleDetailMapper.updateById(auditRuleDetail);
    }

    /**
     * 批量删除审批流程节点
     *
     * @param ruleDetailIds 需要删除的审批流程节点ID
     * @return 结果
     */
    @Override
    public int deleteAuditRuleDetailByIds(String[] ruleDetailIds) {
        return auditRuleDetailMapper.deleteBatchIds(Arrays.asList(ruleDetailIds));
    }

    /**
     * 删除审批流程节点信息
     *
     * @param ruleDetailId 审批流程节点ID
     * @return 结果
     */
    @Override
    public int deleteAuditRuleDetailById(String ruleDetailId) {
        return auditRuleDetailMapper.deleteById(ruleDetailId);
    }
}
